from monthor.Base.Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    name_log = (By.XPATH, '/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')

    def login_name(self, test):
        self.send_keys(self.name_log, test)

    pwd_log = (By.XPATH, '/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')

    def login_pwd(self, test):
        self.send_keys(self.pwd_log, test)

    deng_log = (By.XPATH, '/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]')

    def login_deng(self):
        self.click(self.deng_log)

    qve_log = (By.XPATH, '/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]')

    def login_qve(self):
        self.click(self.qve_log)

    def login_go(self,name,pwd):
        self.open_url("http://localhost:8080/loginn")
        print("打开网址")
        self.login_name(name)
        print("输入用户名字")
        self.login_pwd(pwd)
        time.sleep(2)
        print("输入密码")
        self.login_deng()
        print("点击登录")
        time.sleep(2)
        self.login_qve()
        self.nwewindow()
        print("确认登陆")
        time.sleep(2)


